package org.aspectsense.examples.adaptivemail;

import org.aspectsense.middleware.interfaces.MailUIService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class HFMailUI implements BundleActivator {

	private ServiceRegistration serviceRegistration;
	private HFMailUIImpl hf;
	
	public void start(BundleContext context) throws Exception {
		
		hf = new HFMailUIImpl();
		assert serviceRegistration == null;
		
	     serviceRegistration = context.registerService(MailUIService.class.getName(), hf, null);
	     
	}
	
	
	public void stop(BundleContext context) throws Exception {
		 if(serviceRegistration != null)
	        {
	            serviceRegistration.unregister();
	            serviceRegistration = null;
	        }
	}

}
